import { request } from '@/utils/request/request';
import { RequestEnum } from '@/enums/httpEnum';

export const travelPlanApi = {
  travelPlanList: '/travelPlan/list',
  travelPlanDetail: '/travelPlan/detail',
  travelPlanEditDetail: '/travelPlan/editDetail',
  travelPlanAdd: '/travelPlan/add',
  travelPlanUpdate: '/travelPlan/update',
  worksList: '/travelPlan/workList',
  travelPlanDelete: '/travelPlan/delete',
} as const;

export const getTravelPlanList = (params: API.travelPlanListRequest) => {
  return request({
    url: travelPlanApi.travelPlanList,
    method: RequestEnum.GET,
    params,
  });
};

export const addTravelPlan = (data: API.CreateTravelPlanData) => {
  return request({
    url: travelPlanApi.travelPlanAdd,
    method: RequestEnum.POST,
    data,
  });
};

export const updateTravelPlan = (data: API.UpdateTravelPlanParams) => {
  return request({
    url: travelPlanApi.travelPlanUpdate,
    method: RequestEnum.POST,
    data,
  });
};

export const getWorksList = (params: API.travelPlanListRequest) => {
  return request({
    url: travelPlanApi.worksList,
    method: RequestEnum.GET,
    params,
  });
};

export const deleteTravelPlan = (params: { id: number }) => {
  return request({
    url: travelPlanApi.travelPlanDelete,
    method: RequestEnum.DELETE,
    params,
  });
};
